package com.gzy.android_douban.ui;

import android.os.Bundle;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.gzy.android_douban.R;

import java.util.ArrayList;
import java.util.List;

public class MainActivity2 extends AppCompatActivity {

    private RecyclerView recyclerView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        recyclerView = findViewById(R.id.recyclerView);

        List<News> newsList = new ArrayList<>();
        News news1 = new News(R.drawable.tutu001,"标题1","文字怎自身的那份牛市的发挥市场牛231");
        News news2 = new News(R.drawable.tutu002,"标题2","是丢你发丢viu的v牛啊四季豆巨热");
        newsList.add(news1);
        newsList.add(news2);

        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        recyclerView.setLayoutManager(layoutManager);
        MyAdapter myAdapter = new MyAdapter(newsList);

        recyclerView.setAdapter(myAdapter);
    }
}
